<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="账户类型">
              <j-dict-select-tag placeholder="请选择账户类型" v-model="queryParam.accountType" dictCode="account_type"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a-button @click="handleAdd" type="primary" icon="plus" style="margin-left: 18px">新增</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>

    <finance-account-modal ref="modalForm" @ok="modalFormOk"></finance-account-modal>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import FinanceAccountModal from './modules/FinanceAccountModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'


export default {
  name: 'FinanceAccountList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    FinanceAccountModal
  },
  data() {
    return {
      description: '账单 - 账户管理页面',
      // 表头
      columns: [
        {
          title: '#', dataIndex: '', key: 'rowIndex', width: 60, align: "center", customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {title: '名称', align: "center", dataIndex: 'title'},
        {title: '类型', align: "center", dataIndex: 'accountType_dictText'},
        {title: '余额', align: "center", dataIndex: 'money'},
        {title: '账号', align: "center", dataIndex: 'accountNumber'},
        {
          title: '开卡时间', align: "center", dataIndex: 'startDate', customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '到期时间', align: "center", dataIndex: 'endData', customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {title: '封面', align: "center", dataIndex: 'cover', scopedSlots: {customRender: 'imgSlot'}},
        {title: '持卡人', align: "center", dataIndex: 'userName'},
        {title: '安全码', align: "center", dataIndex: 'securityCode'},
        {title: '密码', align: "center", dataIndex: 'passwd'},
        {title:'出账日', align:"center", dataIndex: 'payOutDay', customRender:function (text) {return !text?"":(text.length>10?text.substr(0,10):text)}},
        {title:'还款日', align:"center", dataIndex: 'repaymenDay', customRender:function (text) {return !text?"":(text.length>10?text.substr(0,10):text)}},
        {title: '操作', dataIndex: 'action', align: "center", fixed: "right", width: 147, scopedSlots: {customRender: 'action'}}
      ],
      url: {
        list: "/finance/financeAccount/list",
        delete: '/finance/financeAccount/delete',
        deleteBatch: "/finance/financeAccount/deleteBatch",

      },
      dictOptions: {},
      superFieldList: [],
    }
  },
  created() {
  },
  methods: {}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>